package com.dzb.langchain4j.util;

import com.dzb.langchain4j.entity.AdmissionStatus;
import com.dzb.langchain4j.vo.AdmissionStatusVO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 录取状态转换工具类
 */
public class AdmissionStatusConverter {
    
    /**
     * 实体类转VO
     */
    public static AdmissionStatusVO toVO(AdmissionStatus entity) {
        if (entity == null) {
            return null;
        }
        AdmissionStatusVO vo = new AdmissionStatusVO();
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }
    
    /**
     * VO转实体类
     */
    public static AdmissionStatus toEntity(AdmissionStatusVO vo) {
        if (vo == null) {
            return null;
        }
        AdmissionStatus entity = new AdmissionStatus();
        BeanUtils.copyProperties(vo, entity);
        return entity;
    }
    
    /**
     * 实体类列表转VO列表
     */
    public static List<AdmissionStatusVO> toVOList(List<AdmissionStatus> entityList) {
        if (entityList == null) {
            return null;
        }
        return entityList.stream()
                .map(AdmissionStatusConverter::toVO)
                .collect(Collectors.toList());
    }
    
    /**
     * VO列表转实体类列表
     */
    public static List<AdmissionStatus> toEntityList(List<AdmissionStatusVO> voList) {
        if (voList == null) {
            return null;
        }
        return voList.stream()
                .map(AdmissionStatusConverter::toEntity)
                .collect(Collectors.toList());
    }
} 